# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessage do
  @moduledoc """
  Represents a response message that can be returned by a conversational agent. Response messages are also used for output audio synthesis. The approach is as follows: * If at least one OutputAudioText response is present, then all OutputAudioText responses are linearly concatenated, and the result is used for output audio synthesis. * If the OutputAudioText responses are a mixture of text and SSML, then the concatenated result is treated as SSML; otherwise, the result is treated as either text or SSML as appropriate. The agent designer should ideally use either text or SSML consistently throughout the bot design. * Otherwise, all Text responses are linearly concatenated, and the result is used for output audio synthesis. This approach allows for more sophisticated user experience scenarios, where the text displayed to the user may differ from what is heard.

  ## Attributes

  *   `channel` (*type:* `String.t`, *default:* `nil`) - The channel which the response is associated with. Clients can specify the channel via QueryParameters.channel, and only associated channel response will be returned.
  *   `conversationSuccess` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageConversationSuccess.t`, *default:* `nil`) - Indicates that the conversation succeeded.
  *   `endInteraction` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageEndInteraction.t`, *default:* `nil`) - Output only. A signal that indicates the interaction with the Dialogflow agent has ended. This message is generated by Dialogflow only when the conversation reaches `END_SESSION` page. It is not supposed to be defined by the user. It's guaranteed that there is at most one such message in each response.
  *   `knowledgeInfoCard` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageKnowledgeInfoCard.t`, *default:* `nil`) - Represents info card for knowledge answers, to be better rendered in Dialogflow Messenger.
  *   `liveAgentHandoff` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageLiveAgentHandoff.t`, *default:* `nil`) - Hands off conversation to a human agent.
  *   `mixedAudio` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageMixedAudio.t`, *default:* `nil`) - Output only. An audio response message composed of both the synthesized Dialogflow agent responses and responses defined via play_audio. This message is generated by Dialogflow only and not supposed to be defined by the user.
  *   `outputAudioText` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageOutputAudioText.t`, *default:* `nil`) - A text or ssml response that is preferentially used for TTS output audio synthesis, as described in the comment on the ResponseMessage message.
  *   `payload` (*type:* `map()`, *default:* `nil`) - Returns a response containing a custom, platform-specific payload.
  *   `playAudio` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessagePlayAudio.t`, *default:* `nil`) - Signal that the client should play an audio clip hosted at a client-specific URI. Dialogflow uses this to construct mixed_audio. However, Dialogflow itself does not try to read or process the URI in any way.
  *   `telephonyTransferCall` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageTelephonyTransferCall.t`, *default:* `nil`) - A signal that the client should transfer the phone call connected to this agent to a third-party endpoint.
  *   `text` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageText.t`, *default:* `nil`) - Returns a text response.
  *   `toolCall` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ToolCall.t`, *default:* `nil`) - Returns the definition of a tool call that should be executed by the client.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :channel => String.t() | nil,
          :conversationSuccess =>
            GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageConversationSuccess.t()
            | nil,
          :endInteraction =>
            GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageEndInteraction.t()
            | nil,
          :knowledgeInfoCard =>
            GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageKnowledgeInfoCard.t()
            | nil,
          :liveAgentHandoff =>
            GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageLiveAgentHandoff.t()
            | nil,
          :mixedAudio =>
            GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageMixedAudio.t()
            | nil,
          :outputAudioText =>
            GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageOutputAudioText.t()
            | nil,
          :payload => map() | nil,
          :playAudio =>
            GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessagePlayAudio.t()
            | nil,
          :telephonyTransferCall =>
            GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageTelephonyTransferCall.t()
            | nil,
          :text =>
            GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageText.t()
            | nil,
          :toolCall =>
            GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ToolCall.t() | nil
        }

  field(:channel)

  field(:conversationSuccess,
    as:
      GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageConversationSuccess
  )

  field(:endInteraction,
    as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageEndInteraction
  )

  field(:knowledgeInfoCard,
    as:
      GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageKnowledgeInfoCard
  )

  field(:liveAgentHandoff,
    as:
      GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageLiveAgentHandoff
  )

  field(:mixedAudio,
    as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageMixedAudio
  )

  field(:outputAudioText,
    as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageOutputAudioText
  )

  field(:payload, type: :map)

  field(:playAudio,
    as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessagePlayAudio
  )

  field(:telephonyTransferCall,
    as:
      GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageTelephonyTransferCall
  )

  field(:text, as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessageText)

  field(:toolCall, as: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ToolCall)
end

defimpl Poison.Decoder,
  for: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessage do
  def decode(value, options) do
    GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessage.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3beta1ResponseMessage do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
